#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int rd() {
    int s=0,m=0;char ch=getchar();
    while(!isdigit(ch)) {if(ch=='-')m=1;ch=getchar();}
    while( isdigit(ch)) s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
    return m?-s:s;
}
const int M=1e9+7;
int n,m,a[305][305];
namespace subtask1 {
    int f[305];
    void main() {
        for(int ii=1;ii<=m;ii++) {
            a[1][ii]^=1,f[0]=1;
            for(int i=1;i<=m;i++) {
                f[i]=f[i-1];
                for(int j=i-1;j>=1;j--) {
                    if(a[1][j]!=a[1][j+1]) break;
                    f[i]=(f[i]+f[j-1])%M;
                }
            }
            a[1][ii]^=1;
            printf("%lld ",f[m]);
        }
    }
}
signed main(){
    freopen("disanti.in","r",stdin);freopen("disanti.out","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) scanf("%1lld",&a[i][j]);
    if(n==1) {subtask1::main();return 0;}
    return 0;
}